from datetime import datetime
def log(msg):
    dt=datetime.today()
    now=dt.strftime('%Y-%m-%d %H:%M:%S')
    line='%s: %s\n'%(now,msg)
    log_file.write(line)
log_file=open('log.txt','a')
log('hello')
log('world')
log_file.close()
